import type {
  DictionaryGroupInfo,
  DictionaryGroupSaveOrUpdateParams,
} from '@/types'

const controller = getAjaxBaseUrl('/sysDictionaryGroup')

/** 新增或更新字典分组数据 */
export function saveOrUpdate(params: Partial<DictionaryGroupSaveOrUpdateParams>) {
  return post(`${controller}/saveOrUpdateDictionaryGroup`, params)
}

/** 查询字典分组递归 */
export function queryTreeList() {
  return get<DictionaryGroupInfo[]>(`${controller}/queryTreeList`)
}

/** 删除菜单 */
export function deleteById(id: number) {
  return get(`${controller}/deleteDictionaryGroup`, { id })
}
